/**
 * TaskMaster v1 - Main Entry Point
 * AceFlow v3.0 - Implementation Phase
 */

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import router from './router'
import App from './App.vue'
import { useAuthStore } from './stores/auth'

const app = createApp(App)

// Use plugins
app.use(createPinia())
app.use(router)
app.use(ElementPlus)

// Initialize authentication state
const authStore = useAuthStore()

// Initialize auth asynchronously
authStore.initializeAuth().then(() => {
  // Mount app after auth initialization
  app.mount('#app')
}).catch((error) => {
  console.error('Auth initialization failed:', error)
  // Mount app anyway
  app.mount('#app')
})
